#  Copyright (c) 2021. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
#  Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
#  Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
#  Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
#  Vestibulum commodo. Ut rhoncus gravida arcu.

from django.db import models
import django.utils.timezone as timezone
# Create your models here.
class user(models.Model):
    # 用户数据库字段
    id = models.AutoField(primary_key=True)
    OpenID = models.CharField(max_length=40,verbose_name='小程序开放ID',unique=True)
    session_key = models.CharField(max_length=40,verbose_name='Session_key')
    nickName = models.CharField(max_length=40,verbose_name='用户昵称')
    avatarUrl = models.CharField(max_length=900,verbose_name='用户头像')
    gender = models.IntegerField(default=0,verbose_name='性别')
    country = models.CharField(max_length=100,verbose_name='国家')
    province = models.CharField(max_length=100,verbose_name='省份')
    city = models.CharField(max_length=100,verbose_name='城市')
    language = models.CharField(max_length=100,verbose_name='所在地语言')
    jifen = models.IntegerField('积分',default=0)
    token = models.CharField('token',max_length=200,default='')


class sig_user_task(models.Model):
    # 签到字段
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=40,verbose_name='任务名称')
    img_url = models.URLField(verbose_name='卡片背景图片URL')
    task_jifen = models.IntegerField(verbose_name='签到给予积分数量')
    task_start_date = models.TimeField(verbose_name='签到开始时间',default = timezone.now)
    task_end_date = models.TimeField(verbose_name='签到结束时间', default=timezone.now)
    sig_text = models.TextField(verbose_name='任务描述内容控制在300字符')
    xianshi = models.BooleanField(verbose_name='是否显示')
    XunHuan = models.BooleanField(verbose_name='是否每日循环/只执行一次')

class sig_user_jl(models.Model):
    # 签到绑定用户字段
    id = models.AutoField(primary_key=True)
    sig_user_id = models.IntegerField(verbose_name='签到绑定用户ID')
    sig_id = models.IntegerField(verbose_name='签到-绑定放ID')
    Zhuang_tai = models.BooleanField(verbose_name='签到状态',default=False)
    time=models.CharField(max_length=40,verbose_name='任务创建时间')
    chuang_jian_shijian = models.DateTimeField(verbose_name='创建时间',auto_now_add=True)
    jieshu_shijian = models.DateTimeField(verbose_name='最后操作时间', auto_now=True)
